﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Com.Lancetinc.Evs.WpfTools
{
    [ValueConversion(typeof(LevsTheme), typeof(Visibility))]
    public sealed class ThemeToVisibilityConverter : IValueConverter
    {
        public Visibility LightValue { get; set; }
        public Visibility DarkValue { get; set; }

        public ThemeToVisibilityConverter()
        {
            LightValue = Visibility.Visible;
            DarkValue = Visibility.Collapsed;
        }

        public object Convert(object value, Type targetType,
            object parameter, CultureInfo culture)
        {
            if (value is not LevsTheme)
                return null;
            return value.Equals(LevsTheme.Light) ? LightValue : DarkValue;
        }

        public object ConvertBack(object value, Type targetType,
            object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
